package com.yanqu.road.server.cmd.activity.zhounianturntable;

import com.yanqu.road.pb.activity.ZhouNianTurntableProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = GameProtocol.S_ZHOUNIAN_TURNTABLE_SYNC_RECORD, desc = "同步公告")
public class ZhouNianTurntableNoticeCmdFromCorss implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        ZhouNianTurntableProto.SyncTurntableRecordRespMsg reqMsg = ZhouNianTurntableProto.SyncTurntableRecordRespMsg.parseFrom(packet.getBytes());
        for (GamePlayer gamePlayer : GamePlayerMgr.getAllOnlinePlayer()) {
            gamePlayer.sendPacket(ClientProtocol.U_ZHOUNIAN_TURNTABLE_RECORD_SYNC, reqMsg.toBuilder());
        }
    }
}
